//package com.bill99.schedule;
//
//import com.bill99.model.EmailProperties;
//import com.bill99.model.TableauProperties;
//import com.bill99.service.TableauService;
//import com.bill99.util.DateUtil;
//import com.bill99.util.EmailUtil;
//import org.apache.commons.lang3.StringUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.Map;
//
///***
// * class_name: CalculateDelayHourTask
// * package: com.bill99.report.task
// * creat_user:JunLee
// * creat_date: 2018/7/24
// * creat_time: 15:15
// * describe: 定时分析tracker工单预警监控超时时间等数据
// */
//
//@Component
//public class DownloadPicAndSendEmailTask {
//
//
//    @Autowired
//    private EmailUtil emailUtil;
//
//    @Resource(name = "tableauServiceImpl")
//    public TableauService service;
//
//    @Autowired
//    private TableauProperties tableau;
//
//    @Autowired
//    private EmailProperties emailProperties;
//    private static final  Logger LOGGER = LoggerFactory.getLogger(DownloadPicAndSendEmailTask.class);
//
//    /***
//     * describe: execute
//     * creat_time: 2018/7/24 15:48
//     * param: []
//     * return: void
//     */
//    @Scheduled(cron = "0 10 10 * * ?")
//    public void executeInternal(){
//
//        LOGGER.info("DownloadPicAndSendEmailTask execute start.");
//        try {
//            LOGGER.info("DownloadPicAndSendEmailTask tableau={}",tableau);
//            service.generatePic(tableau);
//            sendEmail();
//
//        } catch (Exception e) {
//
//            LOGGER.error("DownloadPicAndSendEmailTask | execute | Exception",e);
//            throw new RuntimeException();
//        }finally {
//            LOGGER.info("DownloadPicAndSendEmailTask execute end.");
//        }
//    }
//
//    private void sendEmail()throws Exception{
//        Map<String, String> params = new HashMap();
//        params.put("subject",tableau.getSubject());
//        params.put("whichView",tableau.getViewName1());
//        params.put("emailAddresses", tableau.getEmailAddresses());//收件人列表，多个用','隔开
//        params.put("templateId",tableau.getTemplateId());//模板ID
//        String nowday = DateUtil.formatDateTime("yyyyMMdd", new Date());
//        params.put("attachments",tableau.getAttachmentsPrefix()+"99bill_ZX_dashboard_"+nowday+".png");
//        params.put("sendEmailUrl",emailProperties.getInterfaceUrl());
//        LOGGER.info("DownloadPicAndSendEmailTask params={}",params);
//        emailUtil.send(params);
//    }
//
//    public static void main(String[] args) {
//        String s = StringUtils.substringBefore("/opt/oracle/tomcat/t-1/webapps/dap-report/WEB-INF/classes/com/bill99/report/task/", "WEB-INF");
//        System.out.println(s);
//    }
//
//
//
//
//}
